'use strict';

/**
 * @ngdoc function
 * @name payPcApp.controller:AboutCtrl
 * @description
 * # AboutCtrl
 * Controller of the payPcApp
 */
angular.module('payPcApp')
    .controller('loginCtrl', function($scope, user_model, AppConfig, $location) {
        $scope.reset_panel = false;
        $scope.login = function() {
            user_model.login({
                userId: $scope.userId,
                password: $scope.password
            }).success(function(resp) {
                console.log(resp);
                if (resp.statusCode == 0) {
                    $scope.error_login = false;
                    AppConfig.data.userId = localStorage['APP_userId'] = resp.employee.employee;
                    $location.path('/mylib');
                    console.log('la');
                } else if (resp.statusCode == 10002) {
                    $scope.error_login = true;
                }
            });
        }
    });